import {ICreateStageOptions, ThemeName, HtmlNodeOptions, INodeData, Bounds, ICreateNodeData, ActionCallback, HistoryChangeCallback, ModifyNodeParam, SelectNodeOptions} from "./interfaces"

export class HtmlNode {
  constructor(options: HtmlNodeOptions = {})

  mount(el: HTMLElement)

  disposeEvents()
}

export declare class NodeWrapper extends HtmlNode {
  get instId(): number

  get host(): HTMLElement

  get selected(): boolean

  get parent(): NodeWrapper | undefined

  get nodeData(): INodeData

  get id(): number

  get bounds(): Bounds

  get globalBounds(): Bounds

  get children(): NodeWrapper[]

  addChildWithData(data: ICreateNodeData, insertIndex?: number): NodeWrapper

  addChild(childNode: NodeWrapper, insertIndex?: number): NodeWrapper

  removeChild(childNode: NodeWrapper): NodeWrapper

  removeFromParent()
}

export declare class CommandManager {
  init(
    stage: Stage,
    callbacks: {
      actionCallback?: ActionCallback,
      historyChangeCallback?: HistoryChangeCallback,
    })
  modifyNodes(modifyData: ModifyNodeParam[], oldSelections: number[])
  selectNode(node: NodeWrapper, options: SelectNodeOptions)
  setSelections(selections: number[], oldSelections: number[])
  addNode(nodeData: INodeData, parentNodeId?: number, insertIndex?: number)
  removeNode(nodeId: number)
}

export declare class Stage {
  get root(): NodeWrapper

  get pureRoot(): any

  get host(): HTMLElement

  get options(): ICreateStageOptions

  get commands(): CommandManager

  constructor(options: ICreateStageOptions)

  changeTheme(theme: ThemeName, invoke = true)

  resize()

  setHoverNode(id: number)

  destroy()
}